# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=xf86-video-vesa
pkgver=2.3.4
pkgrel=4
pkgdesc="X.org vesa video driver"
arch=(i686 x86_64)
license=('custom')
url="https://xorg.freedesktop.org/"
depends=('glibc')
makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=23')
conflicts=('xorg-server<1.19' 'X-ABI-VIDEODRV_VERSION<23' 'X-ABI-VIDEODRV_VERSION>=24')
groups=('xorg-drivers' 'xorg')
source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2{,.sig}
        revert-kernelcheck.patch)
sha256sums=('7bddf4d879dd6f67088ecb203a31e12334aab980174bd0909930a21f32e251c1'
            'SKIP'
            'ef591a342cea65f1b08e84771ae0de84395c98ac8a71739dbf5c0a7f7a36543c')
validpgpkeys=('DD38563A8A8224537D1F90E45B8A2D50A0ECD0D3') #  "Adam Jackson <ajax@nwnk.net>"

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 -R -i "${srcdir}/revert-kernelcheck.patch"
}

build() {
  cd ${pkgname}-${pkgver}

  # Since pacman 5.0.2-2, hardened flags are now enabled in makepkg.conf
  # With them, module fail to load with undefined symbol.
  # See https://bugs.archlinux.org/task/55102 / https://bugs.archlinux.org/task/54845
  export CFLAGS=${CFLAGS/-fno-plt}
  export CXXFLAGS=${CXXFLAGS/-fno-plt}
  export LDFLAGS=${LDFLAGS/,-z,now}

  ./configure --prefix=/usr
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
